﻿@inject INotificationService _notice

<Space>
    <SpaceItem>
        <Button Type="ButtonType.Primary" OnClick="OnTopClick">
            <Icon Type="@IconType.Outline.BorderTop" />
            Top
        </Button>
    </SpaceItem>
    
    <SpaceItem>
        <Button Type="ButtonType.Primary" OnClick="OnBottomClick">
            <Icon Type="@IconType.Outline.BorderBottom" />
            Bottom
        </Button>
    </SpaceItem>
</Space>
<Divider />

<Space>
    <SpaceItem>
        <Button Type="ButtonType.Primary" OnClick="OnTopLeftClick">
            <Icon Type="@IconType.Outline.RadiusUpleft" />
            TopLeft
        </Button>
    </SpaceItem>

    <SpaceItem>
        <Button Type="ButtonType.Primary" OnClick="OnTopRightClick">
            <Icon Type="@IconType.Outline.RadiusUpright" />
            TopRight
        </Button>
    </SpaceItem>
</Space>
<Divider />


<Space>
    <SpaceItem>
        <Button Type="ButtonType.Primary" OnClick="OnBottomLeftClick">
            <Icon Type="@IconType.Outline.RadiusBottomleft" />
            BottomLeft
        </Button>
    </SpaceItem>

    <SpaceItem>
        <Button Type="ButtonType.Primary" OnClick="OnBottomRightClick">
            <Icon Type="@IconType.Outline.RadiusBottomright" />
            BottomRight
        </Button>
    </SpaceItem>
</Space>


@code {
    private async Task OpenWithPlacement(NotificationPlacement placement)
    {
        var config = new NotificationConfig()
            {
                Message = $"Notification {placement} {DateTime.Now :O}",
                Description = "This is the content of the notification. This is the content of the notification. This is the content of the notification.",
                Placement = placement
            };
#if DEBUG
        config.Duration = 0;
#endif

        await _notice.Open(config);
    }

    private async Task OnTopLeftClick()
    {
        await OpenWithPlacement(NotificationPlacement.TopLeft);
    }

    private async Task OnTopRightClick()
    {
        await OpenWithPlacement(NotificationPlacement.TopRight);
    }

    private async Task OnBottomLeftClick()
    {
        await OpenWithPlacement(NotificationPlacement.BottomLeft);
    }

    private async Task OnBottomRightClick()
    {
        await OpenWithPlacement(NotificationPlacement.BottomRight);
    }

    private async Task OnBottomClick()
    {
        await OpenWithPlacement(NotificationPlacement.Bottom);
    }

    private async Task OnTopClick()
    {
        await OpenWithPlacement(NotificationPlacement.Top);
    }
}
